package models

import (
	"github.com/jinzhu/gorm"
	"kop/modules/role/entity"
)

func GetDay7(dB *gorm.DB, roleID int32) entity.Day7 {

	var data = entity.Day7{
		RoleID: roleID,
		Day:    1,
	}

	if err := dB.FirstOrCreate(&data).Error; err != nil {
		panic(err)
	}

	return data
}

func SaveDay7(dB *gorm.DB, day7 *entity.Day7) {

	if err := dB.Save(day7).Error; err != nil {
		panic(err)
	}
}
